#include <stdio.h>
#include <stdlib.h>
typedef int ElemType;

/*分块查找*/
//定义查找表
//索引表
typedef struct{
    int maxValue;
    int low;
    int high;
}Index;
//顺序表存储实际数据
ElemType *list;

/*不考代码，意思意思得了*/

/*二叉排序树*/
//节点
typedef struct{
    int key;
    struct BSTNode *lChild,*rChild;
}BSTNode;
//在二叉排序树中查找(迭代)
BSTNode * bst_search01(BSTNode * tree,int key){
    while(tree->key != key && NULL != tree){
        if(key > tree->key)
            tree = tree->rChild;
        else
            tree = tree->rChild;
    }
    return tree;
}
//在二叉排序树中查找(递归)
BSTNode * bst_search02(BSTNode * tree,int key){
    if(NULL == tree) return NULL;
    if(key == tree->key) return tree;
    if(key > tree->key) return bst_search02(tree->rChild,key);
    if(key < tree->key) return bst_search02(tree->lChild,key);
    return tree;
}
//插入新节点(递归)
int bst_insert02(BSTNode * tree,int data){
    if(NULL == tree) {
        BSTNode * node = (BSTNode *) malloc(sizeof(BSTNode));
        node->key = data;
        node->lChild = node->rChild = NULL;
        tree = node;
        return 1;//插入成功
    }
    if(data == tree->key) return 0;
    if(data > tree->key) return bst_insert02(tree->rChild,data);
    if(data < tree->key) return bst_insert02(tree->lChild,data);
}
//插入新节点(迭代)
int bst_insert01(BSTNode * tree,int data){
    while(NULL != tree){
        if(tree->key == data)
            return 0;
        else if(tree->key < data){
            tree = tree->rChild;
        }else
            tree = tree->lChild;
    }
    tree = (BSTNode *) malloc(sizeof(BSTNode));
    return 1;
}
//构造一颗二叉排序树
void bst_create(BSTNode * t,int data[],int len){
    t = NULL;
    for (int i = 0; i < len; ++i) {
        bst_insert01(t,data[i]);
    }
}
//删除二叉排序树节点（保持性质，不考代码，应该）





int main(void){


    return 0;
}